package com.liushuang.waiwaiim;

import android.app.Application;
import android.content.Context;

import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMOptions;
import com.hyphenate.easeui.EaseIM;
import com.liushuang.waiwaiim.model.Model;

public class IMApplication extends Application {

    private static Context mContext;

    @Override
    public void onCreate() {
        super.onCreate();

        EMOptions options = new EMOptions();
        options.setAcceptInvitationAlways(false);
        options.setAutoAcceptGroupInvitation(false);

        //EaseIM初始化
        if(EaseIM.getInstance().init(this, options)){
            //在做打包混淆时，关闭debug模式，避免消耗不必要的资源
            EMClient.getInstance().setDebugMode(true);
            //EaseIM初始化成功之后再去调用注册消息监听的代码 ...
        }
        EMClient.getInstance().init(this, options);

        Model.getInstance().init(this);

        mContext = this;
    }

    public static Context getGlobalApplication(){
        return mContext;
    }


}
